<template>
  <div id="client">
    <p style="margin-left: 20px">
      &nbsp; 客户编号：
      <el-input
        v-model='dnum'
        style="width: 240px; margin-left: 10px; margin-right: 20px"
        placeholder="请输入单据编号"
        clearable
      >
      </el-input>
      <el-date-picker
      v-model="effectiveDateRange"
        type="daterange"
        align="right"
        unlink-panels
        range-separator="至"
        start-placeholder="开始日期"
        end-placeholder="结束日期"
        :picker-options="pickerOptions"
      >
      </el-date-picker>
      &nbsp;&nbsp;&nbsp;
      <el-select placeholder="报价类型">
        <el-option
         v-model="dtype"
          v-for="item in baojiatype"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option> </el-select
      >&nbsp;&nbsp;&nbsp;
      <el-select
      v-model="dentity"
        placeholder="报价主体"
        style="width: 100px"
      >
        <el-option
          v-for="item in baojiabody"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option> </el-select
      >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<el-button
        type="primary"
      >查询</el-button
      >
    </p>
    <p style="margin-left: 30px; margin-top: 20px">
      业务员：<el-input
        style="width: 240px; margin-left: 10px; margin-right: 20px"
        placeholder="请输入客户"
        clearable
        v-model="saleser"
      ></el-input>
      <el-button
        style="margin-left: -20px; margin-right: 10px"
        @click="dialogFormVisible = true"
      >...</el-button
      >
      &nbsp;&nbsp;&nbsp;
      <el-select placeholder="报价单状态" v-model="dstatus">
        <el-option
          v-for="item in baojiastatus"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option> </el-select
      >&nbsp;&nbsp;&nbsp;
      <el-select placeholder="有效期状态" v-model="vstatus">
        <el-option
          v-for="item in youxiaoqi"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option>
      </el-select>
    </p>
    <el-divider></el-divider>
    <div style="margin-bottom: 20px; margin-right: 20px; float: right">
      <el-button type="primary" @click="goto('quote')">新增</el-button
      >&nbsp;&nbsp;&nbsp;
      <el-button type="success">审核</el-button>&nbsp;&nbsp;&nbsp;
      <el-button type="primary">导入</el-button>&nbsp;&nbsp;&nbsp;
      <el-button>导出</el-button>&nbsp;&nbsp;&nbsp;
      <el-button type="danger">删除</el-button>
    </div>
    <div class="client-content">

      <el-table
        height="500px"
        :data="list"
        border
        style="width: 100%; font-size: 13px"
      >
              <el-table-column prop="dId" label="myId">
      </el-table-column>
        <el-table-column type="selection" width="55px"> </el-table-column>
        <el-table-column prop="ddate" label="单据日期" width="150">
        </el-table-column>
        <el-table-column prop="dnum" label="单据编号" width="120">
        </el-table-column>
        <el-table-column prop="dtype" label="报价类型" width="120">
        </el-table-column>
        <el-table-column prop="dentity" label="报价主体" width="120">
        </el-table-column>
        <el-table-column prop="dstatus" label="单据单状态" width="300">
        </el-table-column>
        <el-table-column prop="vstatus" label="有效期状态" width="120">
        </el-table-column>
        <el-table-column prop="qstartTime" label="有效开始时间" width="120">
        </el-table-column>
        <el-table-column prop="qendTime" label="有效结束时间" width="300">
        </el-table-column>
        <el-table-column prop="saleser" label="业务员" width="120">
        </el-table-column>
        <el-table-column prop="dmethod" label="交货方式" width="120">
        </el-table-column>
        <el-table-column prop="sellorder" label="关联销货订单号" width="120">
        </el-table-column>
        <el-table-column prop="quantity" label="商品数量" width="300">
        </el-table-column>
        <el-table-column prop="amount" label="金额" width="300">
        </el-table-column>
        <el-table-column prop="preparationTime" label="制单时间" width="300">
        </el-table-column>
        <el-table-column prop="reviewer" label="审核人" width="300">
        </el-table-column> -->
          <template >
            <el-switch
              active-color="#66b1ff"
              inactive-color="#c1c1c1"
              active-value="200333"
              inactive-value="0"
            >
            </el-switch>
          </template>
     
        <el-table-column fixed="right" label="操作" width="100">
          <template slot-scope="scope">
            <el-button @click="handleClick(scope.row)" type="text" size="small"
              >查看</el-button
            >
            <el-button type="text" size="small">编辑</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
<<<<<<< HEAD
   <el-pagination
        style="margin-top: 20px"
        background
        layout="prev, pager, next"
        @current-change="handleCurrentChange"
        :page-size="8"
        :total="this.pageInfo.total">
=======
  <el-pagination
      style="margin-top: 20px"
      background
      layout="prev, pager, next, jumper, ->, total"
      :current-page="currentPage"
      :page-size="pageSize"
      :total="pageInfo.total"
      @current-change="handleCurrentChange"
    >
>>>>>>> 6be95d2b3200ab6fbb17d1e0a5a9b367f780cc8e
    </el-pagination>
    <el-dialog top="20px" title="新增客户" :visible.sync="dialogFormVisible">
      <AddClient />
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogFormVisible = false"
          >确 定</el-button
        >
      </div>
    </el-dialog>
    <div style="height: 20px; clear: both"></div>
    <el-dialog top="20px" title="选择业务员" :visible.sync="dialogFormVisible">
      <el-input
        placeholder="请输入编号或名称"
        style="width: 200px; margin-left: 20px"
      ></el-input>
      <el-checkbox style="margin-left: 20px"
        >显示禁用职员</el-checkbox
      >
      <el-button type="success" style="margin-left: 20px">查询</el-button>
      <el-table :data="gridData">
        <el-table-column type="selection" width="55"> </el-table-column>
        <el-table-column
          width="100"
          property="name"
          label="类别"
        ></el-table-column>
        <el-table-column
          width="100"
          property="address"
          label="编号"
        ></el-table-column>
        <el-table-column
          width="300"
          property="address"
          label="名称"
        ></el-table-column>
        <el-table-column
          width="100"
          property="address"
          label="联系人"
        ></el-table-column>
        <el-table-column
          width="100"
          property="address"
          label="手机"
        ></el-table-column>
        <el-table-column
          width="100"
          property="address"
          label="备注"
        ></el-table-column>
      </el-table>
      <div class="block">
        <span class="demonstration"></span>
        <el-pagination layout="prev, pager, next" :total="1000">
        </el-pagination>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogFormVisible = false"
          >确 定</el-button
        >
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: "qList",
  data() {
    return {
      dialogFormVisible: false,
      list:[],
        dentity:'',
        dtype:'',
        saleser:'',
        dstatus:'',
        vstatus:'',
        dnum:'',
<<<<<<< HEAD
        pageInfo:''
=======
        pageInfo:'',
        currentPage: 1,
>>>>>>> 6be95d2b3200ab6fbb17d1e0a5a9b367f780cc8e
    };
  },
  methods: {
    handleClick(row) {
      this.$router.push({
        path: "/quoteDetail",
        query: {
          id: row.id,
        },
      });
    },
    goto(path) {
      this.$router.push({
        path: path,
      });
    },
    getList(){
      this.axios({
        url:'/quote/list',
        params:{
<<<<<<< HEAD
          pageNum:1,
=======
          pageNum:this.currentPage,
>>>>>>> 6be95d2b3200ab6fbb17d1e0a5a9b367f780cc8e
          pageSize:5,
           dentity:this.dentity,
           dtype:this.dtype,
           saleser:this.saleser,
           dstatus:this.dstatus,
           vstatus:this.vstatus,
        }
      }).then(rs=>{
        this.list = rs.data.pageInfo.list
<<<<<<< HEAD
        console.log(this.list)
      })
  },
    handleCurrentChange(val) {
      console.log(val)
      this.getList(val,5)
=======
        this.pageInfo=rs.data.pageInfo
        console.log(rs.data.pageInfo)
      })
  },
    handleCurrentChange(val) {
     
      if (val > this.pageInfo.pages) { // 假设后端返回的分页信息中包含总页数
     return;
    } else {
      this.currentPage = val;
      this.getList();
    }
>>>>>>> 6be95d2b3200ab6fbb17d1e0a5a9b367f780cc8e
    },
  },created(){
    this.getList()
  }
}
</script>

<style scoped>
#client {
  width: 100%;
  height: 100%;
}

.client-top {
  width: calc(100% -20px);
  height: 60px;
  /* background-color: pink; */
  line-height: 60px;
  padding-left: 20px;
  font-size: 13px;
}

.client-content {
  width: 100%;
  height: calc(100% - 60px);
  /* background-color: skyblue; */
}

.el-input,
.el-button {
  font-size: 13px;
}
</style>